<mat-card class="card">
  <mat-card-header>
    <h3 mat-card-title>
      {{ 'General Info' | translate }}
    </h3>

    <button
      mat-button
      ixTest="edit-instance"
      (click)="editInstance()"
    >
      {{ 'Edit' | translate }}
    </button>
  </mat-card-header>

  <mat-card-content>
    @if (instance(); as instance) {
      <p>
        <span class="label">{{ 'Autostart' | translate }}:</span>
        {{ instance.autostart | yesNo }}
      </p>
      <p>
        <span class="label">{{ 'Base Image' | translate }}:</span>
        {{ instance.image.description || instance.image.os || '-' }}
      </p>
      <p>
        <span class="label">{{ 'CPU' | translate }}:</span>
        {{ instance.cpu || ('All Host CPUs' | translate) }}
      </p>
      <p>
        <span class="label">{{ 'Memory' | translate }}:</span>
        {{ formatter.memorySizeFormatting(instance.memory) || ('Available Host Memory' | translate) }}
      </p>
      <p>
        <span class="label">{{ 'Storage Pool' | translate }}:</span>
        {{ instance.storage_pool || '-' }}
      </p>

      @if (this.isVm()) {
        <p>
          <span class="label">{{ 'Secure Boot' | translate }}:</span>
          {{ instance.secure_boot | yesNo }}
        </p>
      }

      @if (instance.environment && (instance.environment | keyvalue)?.length) {
        <span class="environment-variables" [matTooltip]="environmentVariablesTooltip()">
          {{ '{n, plural, one {# Environment Variable} other {# Environment Variables} }' | translate: { n: (instance.environment | keyvalue)?.length } }}
        </span>
      }
    }
  </mat-card-content>

  <mat-card-actions>
    <button
      *ixRequiresRoles="[Role.VirtInstanceDelete]"
      mat-button
      ixTest="delete-instance"
      (click)="deleteInstance()"
    >
      {{ 'Delete' | translate }}
    </button>
  </mat-card-actions>
</mat-card>

